﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 小工具合集
{
    public partial class 电容值计算 : Form
    {
        public 电容值计算()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double cap;
            if (radioButton1.Checked == true)
            {
                cap = double.Parse(textBox3.Text) / 1000000;
            }
            else if (radioButton2.Checked == true)
            {
                cap = double.Parse(textBox3.Text) / 1000;
            }
            else
            {
                cap = double.Parse(textBox3.Text);
            }

            double PI = 3.1415926;
            double Xc;
            double fc = double.Parse(textBox1.Text) / 1000 / 1000;
            Xc = 1 / (2 * PI * cap * fc);
            textBox2.Text = Xc.ToString("0.00");
        }
    }
}
